﻿Imports System
Imports DotNetNuke
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Localization
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Security.Roles

Namespace TN.Module.FormerStudents
    Partial Public Class EditProfileSettings
        Inherits Entities.Modules.ModuleSettingsBase

#Region "Base Method Implementations"

        Public Overrides Sub LoadSettings()
            Try
                Dim sLanguage As String = TNFormerStudentHepler.GetCurrentLanguage(Response)
                Dim arrGroups As ArrayList = RoleController.GetRoleGroups(PortalId)
                drdRoleGroup.DataSource = arrGroups
                drdRoleGroup.DataBind()

                If CType(Settings(TNFormerStudentContants.RoleGroupIdSetting + sLanguage + PortalId.ToString), String) <> "" Then
                    drdRoleGroup.SelectedValue = Convert.ToInt32(Settings(TNFormerStudentContants.RoleGroupIdEditSetting + sLanguage + PortalId.ToString))
                End If
            Catch exc As Exception
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

        Public Overrides Sub UpdateSettings()
            Try
                Dim sLanguage As String = TNFormerStudentHepler.GetCurrentLanguage(Response)
                Dim ctlModule As ModuleController = New ModuleController
                ctlModule.UpdateModuleSetting(ModuleId, TNFormerStudentContants.RoleGroupIdEditSetting + sLanguage + PortalId.ToString, drdRoleGroup.SelectedValue.ToString)

            Catch exc As Exception
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

#End Region
    End Class
End Namespace
